% construct diffusion and random force part
function rest = randomforce(t,y,R,sig)

load('orthbase');

load('indexJNKR');

row=size(JNKR,1); colum=size(JNKR,2);
if row >=2
    rest(row)=0;
end
tmp = JNKR(sum(JNKR,2)==1,:);
deltat=1/99;
t2index=floor((t+0.5*deltat)/deltat)+1;
rest(1)=R(t)-1/2*sig(1+(t2index-1)*101).^2;
for ii=1:colum
    rdforce= tmp(:,ii)==1;
    rest(rdforce)= rest(rdforce)+sig(1+101*(ii-1))*ms{ii}(t);
end

rest=rest';




